package com.wjgl.service;

import java.util.List;

import com.wjgl.dao.DepartmentDAO;
import com.wjgl.dao.InstitutionDAO;
import com.wjgl.domain.Department;
import com.wjgl.domain.Institution;

public class DepartmentService {
	private DepartmentDAO departmentDAO;
	private InstitutionDAO institutionDAO;

	public void setDepartmentDAO(DepartmentDAO departmentDAO) {
		this.departmentDAO = departmentDAO;
	}
	
	
	public void setInstitutionDAO(InstitutionDAO institutionDAO) {
		this.institutionDAO = institutionDAO;
	}


	public List<Department> getAllDepartmentsInInstitution(int institutionId){
		Institution ins = institutionDAO.findById(institutionId);
		return departmentDAO.findByProperty("institution", ins);
	}
	
}
